﻿<ResourceDictionary     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
    <ResourceDictionary.MergedDictionaries>
		<ResourceDictionary Source="Brushes.xaml"/>
		<ResourceDictionary Source="TextBlockStyles.xaml"/>
	</ResourceDictionary.MergedDictionaries>
    <Style x:Key="ComboBoxFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle SnapsToDevicePixels="true" Margin="4,4,21,4" Stroke="Red" StrokeDashArray="1 2" StrokeThickness="1"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    <Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="Background" Value="{StaticResource DefaultControlBackground}"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="MinWidth" Value="0"/>
        <Setter Property="MinHeight" Value="0"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="BackGlowEnter">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimation
                                        Storyboard.TargetName="OGlowEfx"
                                        Storyboard.TargetProperty="GlowSize"
                                        From="0" To="2" Duration="00:00:00.3000000" />
                        </Storyboard>
                        <Storyboard x:Key="BackGlowExit">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimation
                                        Storyboard.TargetName="OGlowEfx"
                                        Storyboard.TargetProperty="GlowSize"
                                        From="2" To="0" Duration="00:00:00.3000000" />
                        </Storyboard>
                        <Storyboard x:Key="GlowEnter">
                            <DoubleAnimation
                                        Storyboard.TargetName="GlowEfx"
                                        Storyboard.TargetProperty="GlowSize"
                                        From="0" To="3" Duration="00:00:00.3000000" />
                        </Storyboard>
                        <Storyboard x:Key="GlowExit">
                            <DoubleAnimation
                                        Storyboard.TargetName="GlowEfx"
                                        Storyboard.TargetProperty="GlowSize"
                                        From="3" To="0" Duration="00:00:00.3000000" />
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Border>
                        <Border.BitmapEffect>
                            <OuterGlowBitmapEffect x:Name="OGlowEfx"
                                    GlowColor="#FF555555" GlowSize="0"/>
                        </Border.BitmapEffect>
                        <Border Name="OBorder"
                                CornerRadius="0" 
                                Background="Transparent"                        
                                BorderThickness="0,0,0,1" 
                                BorderBrush="{StaticResource ComboBoxBorder}" Margin="-1">
                            <Border.BitmapEffect>
                                <OuterGlowBitmapEffect x:Name="GlowEfx"
                                    GlowColor="#FF777777" GlowSize="0"/>
                            </Border.BitmapEffect>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="0.507*"/>
                                    <RowDefinition Height="0.493*"/>
                                </Grid.RowDefinitions>
                                <Border Opacity="1" HorizontalAlignment="Stretch" x:Name="background" Width="Auto" CornerRadius="2" Grid.RowSpan="2" Background="{TemplateBinding Background}"/>
                                <Border Opacity="0" HorizontalAlignment="Stretch" x:Name="glow" Width="Auto" CornerRadius="2" Grid.RowSpan="2">
                                    <Border.Background>
                                        <RadialGradientBrush>
                                            <RadialGradientBrush.RelativeTransform>
                                                <TransformGroup>
                                                    <ScaleTransform ScaleX="6" ScaleY="4"/>
                                                    <SkewTransform AngleX="0" AngleY="0"/>
                                                    <RotateTransform Angle="0"/>
                                                    <TranslateTransform X="-2.5" Y="-1"/>
                                                </TransformGroup>
                                            </RadialGradientBrush.RelativeTransform>
                                            <GradientStop Color="#AA5588FF" Offset="1"/>
                                            <GradientStop Color="#225588FF" Offset="0"/>
                                        </RadialGradientBrush>
                                    </Border.Background>
                                </Border>
                                <ScrollViewer Margin="3,0,3,0" Grid.RowSpan="2" Focusable="false" Background="Transparent" x:Name="PART_ContentHost" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
                            </Grid>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsFocused" Value="False"/>
                                <Condition Property="IsMouseOver" Value="True"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource GlowEnter}"/>
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource GlowExit}"/>
                            </MultiTrigger.ExitActions>
                        </MultiTrigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource BackGlowEnter}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource BackGlowExit}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="HighlightedComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="Background" Value="{StaticResource DefaultControlBackground}"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="MinWidth" Value="0"/>
        <Setter Property="MinHeight" Value="0"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="BackGlowEnter">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
															Storyboard.TargetName="glow" 
															Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimation
                                        Storyboard.TargetName="OGlowEfx"
                                        Storyboard.TargetProperty="GlowSize"
                                        From="0" To="2" Duration="00:00:00.3000000" />
                        </Storyboard>
                        <Storyboard x:Key="BackGlowExit">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimation
                                        Storyboard.TargetName="OGlowEfx"
                                        Storyboard.TargetProperty="GlowSize"
                                        From="2" To="0" Duration="00:00:00.3000000" />
                        </Storyboard>
                        <Storyboard x:Key="GlowEnter">
                            <DoubleAnimation
                                        Storyboard.TargetName="GlowEfx"
                                        Storyboard.TargetProperty="GlowSize"
                                        From="0" To="3" Duration="00:00:00.3000000" />
                        </Storyboard>
                        <Storyboard x:Key="GlowExit">
                            <DoubleAnimation
                                        Storyboard.TargetName="GlowEfx"
                                        Storyboard.TargetProperty="GlowSize"
                                        From="3" To="0" Duration="00:00:00.3000000" />
                        </Storyboard>
                    </ControlTemplate.Resources>
					<Grid>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="10"/>
					</Grid.ColumnDefinitions>
                     <Border>
                        <Border.BitmapEffect>
                            <OuterGlowBitmapEffect x:Name="OGlowEfx"
                                    GlowColor="#FF555555" GlowSize="0"/>
                        </Border.BitmapEffect>
                        <Border Name="OBorder"
                                CornerRadius="0" 
                                Background="Transparent"                        
                                BorderThickness="0,0,0,1" 
                                BorderBrush="{StaticResource ComboBoxBorder}" Margin="-1">
                            <Border.BitmapEffect>
                                <OuterGlowBitmapEffect x:Name="GlowEfx"
                                    GlowColor="#FF777777" GlowSize="0"/>
                            </Border.BitmapEffect>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="0.507*"/>
                                    <RowDefinition Height="0.493*"/>
                                </Grid.RowDefinitions>
                                <Border Opacity="1" HorizontalAlignment="Stretch" x:Name="background" Width="Auto" CornerRadius="2" Grid.RowSpan="2" Background="{TemplateBinding Background}"/>
                                <Border Opacity="0" HorizontalAlignment="Stretch" x:Name="glow" Width="Auto" CornerRadius="2" Grid.RowSpan="2">
                                    <Border.Background>
                                        <RadialGradientBrush>
                                            <RadialGradientBrush.RelativeTransform>
                                                <TransformGroup>
                                                    <ScaleTransform ScaleX="6" ScaleY="4"/>
                                                    <SkewTransform AngleX="0" AngleY="0"/>
                                                    <RotateTransform Angle="0"/>
                                                    <TranslateTransform X="-2.5" Y="-1"/>
                                                </TransformGroup>
                                            </RadialGradientBrush.RelativeTransform>
                                            <GradientStop Color="#AA5588FF" Offset="1"/>
                                            <GradientStop Color="#225588FF" Offset="0"/>
                                        </RadialGradientBrush>
                                    </Border.Background>
                                </Border>
                                <ScrollViewer Margin="3,0,3,0" Grid.RowSpan="2" Focusable="false" Background="Transparent" x:Name="PART_ContentHost" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
                            </Grid>
                        </Border>
                    </Border>
					<TextBlock Grid.Column="1"
								FontSize="14"
								Foreground="Red"
								Text="*"
								Name="AsterixTB"
								Visibility="Hidden"
								Margin="3,0,0,0"
								VerticalAlignment="Top"/>
					</Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsFocused" Value="False"/>
                                <Condition Property="IsMouseOver" Value="True"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource GlowEnter}"/>
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource GlowExit}"/>
                            </MultiTrigger.ExitActions>
                        </MultiTrigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource BackGlowEnter}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource BackGlowExit}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="TextBox.Text" Value="">
                            <Setter TargetName="OBorder" Property="BorderBrush" Value="Red"/>
							<Setter TargetName="AsterixTB" Property="Visibility" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="ComboBoxTransparentButtonStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="MinWidth" Value="0"/>
        <Setter Property="MinHeight" Value="4"/>
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="Height" Value="Auto"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="ClickMode" Value="Press"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border BorderThickness="1,0,1,1" Name="Border" CornerRadius="0,0,2,2" BorderBrush="Transparent" Background="{StaticResource DefaultControlBackground}" Padding="2">
                        <Path x:Name="Arrow"
                              Margin="0,1,0,0"
                              Fill="Blue"
                              HorizontalAlignment="Center"
                              VerticalAlignment="Bottom"
                              Opacity="1"
                              Data="M 0 0 L 5 5 L 10 0 Z"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="Gray"/>
                            <Setter TargetName="Arrow" Property="Fill" Value="Red"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
        <Grid SnapsToDevicePixels="true">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition SharedSizeGroup="ComboBoxButton" Height="Auto"/>
                    </Grid.RowDefinitions>
                <Border x:Name="Bd" Background="{x:Null}" BorderThickness="0" Width="{TemplateBinding Width}">
                    <TextBox HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" x:Name="PART_EditableTextBox" Style="{StaticResource ComboBoxEditableTextBox}" Grid.Column="1" IsReadOnly="{Binding Path=IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"/>
                </Border>
                <ToggleButton Background="{x:Null}" Margin="-1,0,-1,0" Style="{StaticResource ComboBoxTransparentButtonStyle}" Grid.ColumnSpan="2" Grid.Row="1" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
            <Popup Focusable="True" 
								AllowsTransparency="true" 
								Placement="Bottom"
								IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" 
							  	PopupAnimation="Fade"
								x:Name="PART_Popup"
								VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
								HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
                            <Border x:Name="DropDownBorder" 
									Background="{StaticResource ComboPopupBackground}" 
									BorderBrush="{StaticResource ListBorder}" 
									CornerRadius="4" 
									BorderThickness="1" 
									Margin="12"
									MinWidth="{TemplateBinding ActualWidth}"
									VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
									HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
                                
                                <ScrollViewer Padding="0,10,0,10">
                                    <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
											KeyboardNavigation.DirectionalNavigation="Contained"/>
                                </ScrollViewer>
                            </Border>
                        </Popup>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="HasItems" Value="false">
                <Setter Property="MinHeight" TargetName="DropDownBorder" Value="95"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
            </Trigger>
            <Trigger Property="IsGrouping" Value="true">
                <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="HighlightedComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
       <Grid SnapsToDevicePixels="true">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition SharedSizeGroup="ComboBoxButton" Height="Auto"/>
                    </Grid.RowDefinitions>
                <Border x:Name="Bd" Background="{x:Null}" BorderThickness="0" Width="{TemplateBinding Width}">
                    <TextBox HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" x:Name="PART_EditableTextBox" Style="{StaticResource HighlightedComboBoxEditableTextBox}" Grid.Column="1" IsReadOnly="{Binding Path=IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"/>
                </Border>
                <ToggleButton Background="{x:Null}" Margin="-1,0,9,0" Style="{StaticResource ComboBoxTransparentButtonStyle}" Grid.ColumnSpan="2" Grid.Row="1" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
            <Popup Focusable="True" 
								AllowsTransparency="true" 
								Placement="Bottom"
								IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" 
							  	PopupAnimation="Fade"
								x:Name="PART_Popup"
								VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
								HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
                            <Border x:Name="DropDownBorder" 
									Background="{StaticResource ComboPopupBackground}" 
									BorderBrush="{StaticResource ListBorder}" 
									CornerRadius="4" 
									BorderThickness="1" 
									Margin="12"
									MinWidth="{TemplateBinding ActualWidth}"
									VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
									HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
                                
                                <ScrollViewer Padding="0,10,0,10">
                                    <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
											KeyboardNavigation.DirectionalNavigation="Contained"/>
                                </ScrollViewer>
                            </Border>
                        </Popup>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="HasItems" Value="false">
                <Setter Property="MinHeight" TargetName="DropDownBorder" Value="95"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
            </Trigger>
            <Trigger Property="IsGrouping" Value="true">
                <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type ComboBox}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}"/>
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="Background" Value="{StaticResource DefaultControlBackground}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ComboBoxBorder}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="MinHeight" Value="31"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBox}">
                    <Grid SnapsToDevicePixels="true">
                        <Border x:Name="Bd" Background="{TemplateBinding Background}" 
								BorderBrush="{TemplateBinding BorderBrush}" 
								BorderThickness="{TemplateBinding BorderThickness}" 
								Padding="1">
                            <Grid Grid.IsSharedSizeScope="true">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="1"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition SharedSizeGroup="ComboBoxButton" Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Border Margin="{TemplateBinding Padding}"
										 x:Name="SelectedItemBorder" 
										 Grid.ColumnSpan="2"
										 BorderBrush="{TemplateBinding BorderBrush}"
										 Background="Transparent"
										 BorderThickness="0,0,0,1"
										 CornerRadius="0"/>
                                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
													HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
													Margin="{TemplateBinding Padding}" 
													VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
													Grid.Column="1" Content="{TemplateBinding SelectionBoxItem}"
													ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" 
													ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"/>
                                <ToggleButton Style="{StaticResource ComboBoxTransparentButtonStyle}" 
												x:Name="ArrowBt"
												Grid.ColumnSpan="2" Grid.Row="1" 
												Margin="{TemplateBinding Padding}"
												IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </Grid>
                        </Border>
                        <Popup Focusable="True" 
								AllowsTransparency="true" 
								Placement="Center"
								IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" 
							  	PopupAnimation="Fade"
								x:Name="PART_Popup"
								VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
								HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
                            <Border x:Name="DropDownBorder" 
									Background="{StaticResource ComboPopupBackground}" 
									BorderBrush="{StaticResource ListBorder}" 
									CornerRadius="4" 
									BorderThickness="1" 
									Margin="12"
									MinWidth="{TemplateBinding ActualWidth}"
									VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
									HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">

                                <ScrollViewer>
                                    <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Contained"/>
                                </ScrollViewer>
                            </Border>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelectionBoxHighlighted" Value="true"/>
                                <Condition Property="IsDropDownOpen" Value="false"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
                        </MultiTrigger>
                        <Trigger Property="HasItems" Value="false">
                            <Setter Property="MinHeight" TargetName="DropDownBorder" Value="95"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsEditable" Value="true">
                <Setter Property="IsTabStop" Value="false"/>
                <Setter Property="Padding" Value="0,1"/>
                <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="HighlightedComboBox" TargetType="{x:Type ComboBox}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ListBorder}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="1"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="MinHeight" Value="31"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBox}">
                    <Grid SnapsToDevicePixels="true">
                        <Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="1">
                            <Grid Grid.IsSharedSizeScope="true">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="1"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition SharedSizeGroup="ComboBoxButton" Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Border Margin="{TemplateBinding Padding}" x:Name="SelectedItemBorder" Grid.ColumnSpan="2"/>
                                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Grid.Column="1" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"/>
                                <ToggleButton Style="{StaticResource ComboBoxTransparentButtonStyle}" Grid.ColumnSpan="2" Grid.Row="1" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
                            </Grid>
                        </Border>
                        <Popup Focusable="false" AllowsTransparency="true" IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" x:Name="PART_Popup">
                            <Border x:Name="DropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
                                <ScrollViewer>
                                    <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Contained"/>
                                </ScrollViewer>
                            </Border>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelectionBoxHighlighted" Value="true"/>
                                <Condition Property="IsDropDownOpen" Value="false"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
                        </MultiTrigger>
                        <Trigger Property="IsSelectionBoxHighlighted" Value="true">
                            <Setter Property="Background" TargetName="SelectedItemBorder" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                        </Trigger>
                        <Trigger Property="HasItems" Value="false">
                            <Setter Property="MinHeight" TargetName="DropDownBorder" Value="95"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsEditable" Value="true">
                <Setter Property="IsTabStop" Value="false"/>
                <Setter Property="Padding" Value="0,1"/>
                <Setter Property="Template" Value="{StaticResource HighlightedComboBoxEditableTemplate}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type ComboBoxItem}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
		<Setter Property="FontSize" Value="12"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                    <Grid SnapsToDevicePixels="True" x:Name="Border" Background="Transparent" Margin="5,3,5,3" VerticalAlignment="Center">
						<Grid.RowDefinitions>
							<RowDefinition Height="0.5*"/>
							<RowDefinition Height="0.5*"/>
						</Grid.RowDefinitions>
                        <Border Name="Ground" 
								Background="White" 
								BorderBrush="Gray" 
								BorderThickness="1" 
								CornerRadius="3"/>                  
						<Border Name="shineTop"
								CornerRadius="3,3,0,0"
								Grid.Row="0">
							<Border.Background>
								<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5, 1">
									<GradientStop Color="#99FFFFFF" Offset="0"/>
									<GradientStop Color="#44FFFFFF" Offset="1"/>
								</LinearGradientBrush>
							</Border.Background>
						</Border>
						<Border Name="shineBottom"
								CornerRadius="0,0,3,3"
								Grid.Row="1">
							<Border.Background>
								<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5, 1">
									<GradientStop Color="#40FFFFFF" Offset="0"/>
									<GradientStop Color="#18FFFFFF" Offset="1"/>
								</LinearGradientBrush>
							</Border.Background>
						</Border>
						<ContentPresenter SnapsToDevicePixels="True" 
											Margin="4"
											HorizontalAlignment="Center" 
											VerticalAlignment="Center"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property = "BitmapEffect" TargetName="Ground" >
                                <Setter.Value>
                                    <DropShadowBitmapEffect Color="Black" Direction="300" ShadowDepth="6" Softness="0.5"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background" TargetName="Ground" Value="#FF4499FF"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
					</ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>